package com.erp.service.impl;

import com.erp.bean.Department;
import com.erp.dao.DepartmentDao;
import com.erp.dao.impl.DepartmentDaoImpl;
import com.erp.service.DepartmentService;

import javax.swing.*;
import java.util.List;

/**
 * @author lyb
 * 创建部门业务逻辑实现类
 */
public class DepartmentServiceImpl implements DepartmentService {
    //创建数据访问对象
    DepartmentDao departmentDao=new DepartmentDaoImpl();
    @Override
    public List<Department> findAll() {
        List<Department> list=departmentDao.findAll();
        return list;
    }

    @Override
    public Department findById(int did) {
        Department department=departmentDao.findById(did);
        return department;
    }

    @Override
    public boolean update(Department department) {

        return departmentDao.update(department)>0?true:false;
    }

    @Override
    public boolean add(Department department) {
        return departmentDao.add(department)>0?true:false;
    }
}
